package collection;

import java.util.Arrays;
import java.util.List;

public class ArrayToList {
    public static void main(String[] args) {
        String[] array={"one","two","three","four","five"};
        System.out.println(Arrays.toString(array));

        //asList()方法返回内部的Arrays,内部直接引用给array数组
        List<String>list= Arrays.asList(array);
        System.out.println(list);

        array[1]="six";
        System.out.println(Arrays.toString(array));
        System.out.println(list);

        list.set(2,"1");
        System.out.println(Arrays.toString(array));
        System.out.println(list);

        //给集合添加或者删除元素相当于给数组添加或删除
        //但数组是定长的，所以运行会报错
        //list.add("!!!");


    }
}
